home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / master / Examples / Shared_Lib / README < prev    next >
Text File  |  1994-02-01  |  2KB  |  51 lines

  1.  
  2.             SHARED_LIB EXAMPLE CODE
  3.  
  4.     This is a fully compilable shared library implemented for DICE
  5.     demonstrating how one can write their very own shared library.  Some
  6.     knowledge in shared libraries is required to understand the code..
  7.     the basic thing to remember is (1) that a shared library is NOT a
  8.     normal C program, and (2) the interface calls MUST be reentrant...
  9.     i.e. multiple tasks can make a library call simultaniously.
  10.  
  11.                 SHARED LIBRARY
  12.  
  13.     DEFS.H    contains header stuff
  14.     TAG.A    library independant basic code
  15.     LIB.C    library independant basic code
  16.     INIT.C    library dependant initialization routines
  17.     FUNCS.C    library dependant routines
  18.  
  19.     TAG.A and LIB.C are almost self contained with only a few modifications
  20.     required to use them for other library projects... basically the
  21.     name of the library in TAG.A and the function list in LIB.C
  22.  
  23.     TAG.A contains a subset of the standard startup code, LIB/AMIGA/C.A,
  24.     and assumes non-resident compilation (i.e. you cannot use the -r
  25.     option).  This isn't a problem since the -r option doesn't gain you
  26.     anything as far as shared libraries go.
  27.  
  28.     The individual library interface routines are declared with the LibCall
  29.     macro, defined in DEFS.H, which ensures the small-data pointer is set
  30.     up for all interface calls allowing use of the small-data model.  The
  31.     register specification for the call arguments must match those in the
  32.     TEST.FD file.
  33.  
  34.     Also, TAG.A must be the FIRST source module specified, and it is in
  35.     this example.
  36.  
  37.                 THE LINK LIB
  38.  
  39.     The Library template generates a link lib, in this case called TEST.LIB,
  40.     which contains library tags and an autoinit module.  The result is
  41.     that the MYTEST program does not need to explicitly open and close
  42.     TEST.LIBRARY!
  43.  
  44.                  COMPILING AND RUNNING
  45.  
  46.     Run the Test.DICE project and Make it under vmake.
  47.  
  48.     Run the mytest.DICE project, Make it under vmake, and then run the
  49.     TEST.SCRIPT script from a shell.
  50.  
  51.